bitkeeper revision 1.1159.1.293 (4180123d6fy9CmhZFhA2dxg-C2tnig)
authorcl349@freefall.cl.cam.ac.uk <cl349@freefall.cl.cam.ac.uk>
Wed, 27 Oct 2004 21:25:17 +0000 (21:25 +0000)
committercl349@freefall.cl.cam.ac.uk <cl349@freefall.cl.cam.ac.uk>
Wed, 27 Oct 2004 21:25:17 +0000 (21:25 +0000)
create.py:
  Set the name of the vm to the config file's basename if no name is
  specified in the config file or on the commandline.
opts.py:
  Handle trailing getopt arguments correctly.

tools/python/xen/xm/create.py
tools/python/xen/xm/opts.py

index 1c0fa6cb4f8b8f26e610f4ddc1d799773cd1b33d..9d977dd337104d5af77b5b1c60d59760911de861 100644 (file)
@@ -465,6 +465,8 @@ def main(argv):
     else:
         opts.load_defconfig()
         preprocess(opts, opts.vals)
+        if not opts.getopt('name') and opts.getopt('defconfig'):
+            opts.setopt('name', os.path.basename(opts.getopt('defconfig')))
         config = make_config(opts.vals)
     if opts.vals.dryrun:
         PrettyPrint.prettyprint(config)
index 0dfee0b7c9ae8af9ebff22d35f238f137d139d7b..f92c82dfe6984f490dda1814dc16b4e3a40d490c 100644 (file)
@@ -313,6 +313,9 @@ class Opts:
                     print >>sys.stderr, "Error: Unknown option:", k
                     self.usage()
 
+            if not args:
+                break
+            
             # then process the 1st arg 
             (arg,args) = (args[0], args[1:])